package com.atguigu.test.domin.credit;

import com.atguigu.domain.credit.model.entity.TradeEntity;
import com.atguigu.domain.credit.model.valobj.TradeNameVO;
import com.atguigu.domain.credit.model.valobj.TradeTypeVO;
import com.atguigu.domain.credit.service.CreditAdjustService;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.math.BigDecimal;

/**
 * @description
 * @Date 2025/6/7 14:55
 * @Created by 27810
 */
@Slf4j
@SpringBootTest
@RunWith(SpringRunner.class)
public class CreditAdjustServiceTest {
    @Resource
    private CreditAdjustService creditAdjustService;

    @Test
    public void test_createOrder_forward(){
        TradeEntity  tradeEntity = TradeEntity.builder()
                .userId("xiaofuge")
                .tradeName(TradeNameVO.REBATE)
                .tradeType(TradeTypeVO.FORWARD)
                .amount(new BigDecimal(10.19))
                .outBusinessNo("100009909911")
                .build();
        creditAdjustService.createOrder(tradeEntity);
    }

    @Test
    public void test_createOrder_reverse() {
        TradeEntity tradeEntity = new TradeEntity();
        tradeEntity.setUserId("xiaofuge");
        tradeEntity.setTradeName(TradeNameVO.REBATE);
        tradeEntity.setTradeType(TradeTypeVO.REVERSE);
        tradeEntity.setAmount(new BigDecimal("-10.19"));
        tradeEntity.setOutBusinessNo("20000990991");
        creditAdjustService.createOrder(tradeEntity);
    }
}
